package avicit.cbb.tabledefine.service.api;

import avicit.platform6.core.rest.msg.ResponseMsg;
import avicit.platform6.core.restclient.RestClient;
import avicit.platform6.core.restclient.RestClientUtils;
import com.github.pagehelper.Page;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class CommTableManagerIntfsServiceApi {


    /**
     * 服务编码
     */
    private static final String SERVICE_CODE = "filebasicmanager";

    private static final String BASE_PATH = "/api/avicit/im/lantop/basic/libstructuredefine/action/rest/LantopArchiveRest";

    @Autowired
    private RestClient restClient;

    /**
     * 获取oldTableId
     * @param orgId
     * @param deptId
     * @param sysId
     * @param nodeId
     * @param s
     * @return
     */
    public List<Map<String, Object>> getCbbTableInfoByNodeIdByIntfs(String orgId, String deptId, String sysId, String nodeId, String s) {
        String url = BASE_PATH + "/getCbbTableInfoByNodeIdByIntfs";
        Map<String,Object> map = new HashMap<>();
        map.put("deptId",deptId);
        map.put("orgId",orgId);
        map.put("sysId",sysId);
        map.put("nodeId",nodeId);
        map.put("s",s);
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     * 调用接口删除CBB相关数据
     * @param orgId
     * @param deptId
     * @param sysId
     * @param nodeId
     * @param s
     */
    public void deleteCbbTableByNodeIdByIntfs(String orgId, String deptId, String sysId, String nodeId, String s) {
        String url = BASE_PATH + "/deleteCbbTableByNodeIdByIntfs";
        Map<String,Object> map = new HashMap<>();
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        map.put("sysId",sysId);
        map.put("nodeId",nodeId);
        map.put("s",s);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map, new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 获得最大表名
     * @param orgId
     * @param deptId
     * @param sysId
     * @param id
     * @return
     */
    public String getCbbMaxTableNameByNodeIdByIntfs(String orgId, String deptId, String sysId, String id) {
        String url = BASE_PATH + "/getCbbMaxTableNameByNodeIdByIntfs";
        Map<String,Object> map = new HashMap<>();
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        map.put("sysId",sysId);
        map.put("id",id);
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, map, new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     *根据节点ID，获取表IDS
     * @param orgId
     * @param deptId
     * @param sysId
     * @param modelId
     * @return
     */
    public List<Map<String, Object>> getCbbTableIdsByNodeIdByIntfs(String orgId, String deptId, String sysId, String modelId) {
        String url = BASE_PATH + "/getCbbTableIdsByNodeIdByIntfs";
        Map<String,Object> map = new HashMap<>();
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        map.put("sysId",sysId);
        map.put("modelId",modelId);
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *创建表与节点关联关系
     * @param orgId
     * @param deptId
     * @param sysId
     * @param id
     * @param tableId
     * @param loginUserId
     * @param loginIp
     * @param param
     */
    public void createCbbTabNodeByIntfs(String orgId, String deptId, String sysId, String id, String tableId, String loginUserId, String loginIp, Map<String, Object> param) {
        String url = BASE_PATH + "/createCbbTabNodeByIntfs";
        Map<String,Object> map = new HashMap<>();
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        map.put("sysId",sysId);
        map.put("id",id);
        map.put("tableId",tableId);
        map.put("loginUserId",loginUserId);
        map.put("loginIp",loginIp);
        map.put("param",param);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
    }

    /**
     *获取表单排列数据
     * @param colMap
     * @param editList
     * @return
     */
    public Map<String, Object> getColumnPageMapItera(Map<String, Object> colMap, List<Map<String, Object>> editList) {
        String url = BASE_PATH + "/getColumnPageMapItera";
        Map<String,Object> map = new HashMap<>();
        map.put("colMap",colMap);
        map.put("editList",editList);
        ResponseMsg<Map<String, Object>> responseMsg = restClient.doPost(SERVICE_CODE, url, map, new ParameterizedTypeReference<ResponseMsg<Map<String, Object>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 获取表单排列数据
     * @param colMap
     * @return
     */
    public Map<String, Object> getColumnPageMap(Map<String, Object> colMap) {
        String url = BASE_PATH + "/getColumnPageMap";
        ResponseMsg<Map<String, Object>> responseMsg = restClient.doPost(SERVICE_CODE, url, colMap, new ParameterizedTypeReference<ResponseMsg<Map<String, Object>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *获取数据排序字段
     * @param tableId
     * @param sysId
     * @param orgId
     * @param deptId
     * @return
     */
    public List<Map<String, Object>> getColDataOrderByTableId(String tableId,String sysId,String orgId,String deptId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("tableId",tableId);
        resMaps.put("sysId",sysId);
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        String url = BASE_PATH + "/getColDataOrderByTableId/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *节点著录定义删除字段信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @param nodeId
     * @param tableId
     * @param colId
     */
    public void deleteCbbTabNodeRecordFieldByIntfs(String orgId,String deptId,String sysId,String nodeId,String tableId,String colId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("nodeId",nodeId);
        resMaps.put("tableId",tableId);
        resMaps.put("colId",colId);
        String url = BASE_PATH + "/deleteCbbTabNodeRecordFieldByIntfs/v1";
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg>() {
        });
        return;
    }





//    public void createCbbTabNodeByIntfs(String orgId,String deptId,String sysId,String nodeId,String tableId,String loginUserId,String loginIp,Map<String, Object> param) {
//        Map<String,Object> resMaps = new HashMap<>();
//        resMaps.put("orgId",orgId);
//        resMaps.put("deptId",deptId);
//        resMaps.put("sysId",sysId);
//        resMaps.put("nodeId",nodeId);
//        resMaps.put("tableId",tableId);
//        resMaps.put("loginUserId",loginUserId);
//        resMaps.put("loginIp",loginIp);
//        resMaps.put("param",param);
//        String url = BASE_PATH + "/createCbbTabNodeByIntfs/v1";
//        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg>() {
//        });
//        return;
//    }


    /**
     *拷贝库表
     * @param orgId
     * @param deptId
     * @param sysId
     * @param oldNodeId
     * @param newNodeId
     * @param loginUserId
     * @param loginIp
     * @param ifTrue
     */
    public void copyCbbTableByNodeIdByIntfs(String orgId,String deptId,String sysId,String oldNodeId,String newNodeId,String loginUserId,String loginIp,Boolean ifTrue) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("oldNodeId",oldNodeId);
        resMaps.put("newNodeId",newNodeId);
        resMaps.put("loginUserId",loginUserId);
        resMaps.put("loginIp",loginIp);
        resMaps.put("ifTrue",ifTrue);
        String url = BASE_PATH + "/copyCbbTableByNodeIdByIntfs/v1";
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg>() {
        });
        return;
    }





//    public List<Map<String, Object>> getCbbTableIdsByNodeIdByIntfs(String orgId,String deptId,String sysId,String nodeId) {
//        Map<String,Object> resMaps = new HashMap<>();
//        resMaps.put("orgId",orgId);
//        resMaps.put("deptId",deptId);
//        resMaps.put("sysId",sysId);
//        resMaps.put("nodeId",nodeId);
//        String url = BASE_PATH + "/getCbbTableIdsByNodeIdByIntfs/v1";
//        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
//        });
//        return RestClientUtils.getResponseBody(responseMsg);
//    }


    /**
     *节点著录定义添加字段信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @param nodeId
     * @param tableId
     * @param colId
     */
    public void addCbbTabNodeRecordFieldByIntfs(String orgId,String deptId,String sysId,String nodeId,String tableId,String colId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("nodeId",nodeId);
        resMaps.put("tableId",tableId);
        resMaps.put("colId",colId);
        String url = BASE_PATH + "/addCbbTabNodeRecordFieldByIntfs/v1";
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg>() {
        });
        return;
    }


    /**
     *获取表与节点关系ID
     * @param orgId
     * @param deptId
     * @param sysId
     * @param nodeId
     * @param tableId
     * @return
     */
    public String getCbbTabNodeIdByIntfs(String orgId,String deptId,String sysId,String nodeId,String tableId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("nodeId",nodeId);
        resMaps.put("tableId",tableId);
        String url = BASE_PATH + "/getCbbTabNodeIdByIntfs/v1";
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *获取系统初始字段信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @return
     */
    public List<Map<String, Object>> getCbbSysInitFieldsByIntfs(String orgId,String deptId,String sysId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        String url = BASE_PATH + "/getCbbSysInitFieldsByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *获取某系统标识下已定义的所有物理表信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @return
     */
    public List<Map<String, Object>> getCbbAllTablesBySysIdByIntfs(String orgId,String deptId,String sysId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        String url = BASE_PATH + "/getCbbAllTablesBySysIdByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据表ID，获取节点信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @param tableId
     * @return
     */
    public List<Map<String, Object>> getNodesByTableIdSysIdByIntfs(String orgId,String deptId,String sysId,String tableId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("tableId",tableId);
        String url = BASE_PATH + "/getNodesByTableIdSysIdByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据模版代码获取模版ID
     * @param templetInfoCode
     * @return
     */
    public String getTempletIdByTempletCode(String templetInfoCode) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("templetInfoCode",templetInfoCode);
        String url = BASE_PATH + "/getTempletIdByTempletCode/v1";
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据表ID，获取列信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @param tableId
     * @param isAll
     * @return
     */
    public List<Map<String, Object>> getCbbTabColumnsByIsAllByIntfs(String orgId,String deptId,String sysId,String tableId,String isAll) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("tableId",tableId);
        resMaps.put("isAll",isAll);
        String url = BASE_PATH + "/getCbbTabColumnsByIsAllByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }





//    public void deleteCbbTableByNodeIdByIntfs(String orgId,String deptId,String sysId,String nodeId,String isTrueTable) {
//        Map<String,Object> resMaps = new HashMap<>();
//        resMaps.put("orgId",orgId);
//        resMaps.put("deptId",deptId);
//        resMaps.put("sysId",sysId);
//        resMaps.put("nodeId",nodeId);
//        resMaps.put("isTrueTable",isTrueTable);
//        String url = BASE_PATH + "/deleteCbbTableByNodeIdByIntfs/v1";
//        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg>() {
//        });
//        return;
//    }





//    public List<Map<String, Object>> getCbbTableInfoByNodeIdByIntfs(String orgId,String deptId,String sysId,String nodeId,String cbbTableIndex) {
//        Map<String,Object> resMaps = new HashMap<>();
//        resMaps.put("orgId",orgId);
//        resMaps.put("deptId",deptId);
//        resMaps.put("sysId",sysId);
//        resMaps.put("nodeId",nodeId);
//        resMaps.put("cbbTableIndex",cbbTableIndex);
//        String url = BASE_PATH + "/getCbbTableInfoByNodeIdByIntfs/v1";
//        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
//        });
//        return RestClientUtils.getResponseBody(responseMsg);
//    }


    /**
     *根据列ID，获取该列的组合项配置信息
     * @param tableId
     * @return
     */
    public List<Map<String, Object>> getColSearchByTableId(String tableId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("tableId",tableId);
        String url = BASE_PATH + "/getColSearchByTableId/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *创建库表
     * @param orgId
     * @param deptId
     * @param sysId
     * @param nodeId
     * @param nodeName
     * @param tabLevel
     * @param moreLevelName
     * @param loginUserId
     * @param loginIp
     * @param ifTrue
     * @param nodeCode
     * @param param
     */
    public void createCbbTableByIntfs(String orgId,String deptId,String sysId,String nodeId,String nodeName,String tabLevel,String moreLevelName,String loginUserId,String loginIp,Boolean ifTrue,String nodeCode,Map<String, Object> param) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("nodeId",nodeId);
        resMaps.put("nodeName",nodeName);
        resMaps.put("tabLevel",tabLevel);
        resMaps.put("moreLevelName",moreLevelName);
        resMaps.put("loginUserId",loginUserId);
        resMaps.put("loginIp",loginIp);
        resMaps.put("ifTrue",ifTrue);
        resMaps.put("nodeCode",nodeCode);
        resMaps.put("param",param);
        String url = BASE_PATH + "/createCbbTableByIntfs/v1";
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg>() {
        });
        return;
    }


    /**
     *根据节点ID，删除表与节点关联关系
     * @param orgId
     * @param deptId
     * @param sysId
     * @param nodeId
     */
    public void deleteCbbTabNodeByNodeIdByIntfs(String orgId,String deptId,String sysId,String nodeId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("nodeId",nodeId);
        String url = BASE_PATH + "/deleteCbbTabNodeByNodeIdByIntfs/v1";
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg>() {
        });
        return;
    }


    /**
     *创建节点著录定义
     * @param orgId
     * @param deptId
     * @param sysId
     * @param nodeId
     * @param tableId
     */
    public void createCbbTabNodeRecordByIntfs(String orgId,String deptId,String sysId,String nodeId,String tableId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("nodeId",nodeId);
        resMaps.put("tableId",tableId);
        String url = BASE_PATH + "/createCbbTabNodeRecordByIntfs/v1";
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg>() {
        });
        return;
    }


    /**
     *获取字段信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @param nodeId
     * @param tableId
     * @return
     */
    public List<Map<String, Object>> getCbbTabColumnsByIntfs(String orgId,String deptId,String sysId,String nodeId,String tableId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("nodeId",nodeId);
        resMaps.put("tableId",tableId);
        String url = BASE_PATH + "/getCbbTabColumnsByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据系统标识ID，表名，获取表ID
     * @param orgId
     * @param deptId
     * @param sysId
     * @param tableName
     * @return
     */
    public String getCbbTableIdByIntfs(String orgId,String deptId,String sysId,String tableName) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("tableName",tableName);
        String url = BASE_PATH + "/getCbbTableIdByIntfs/v1";
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据标识条件，获取字段信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @param tableName
     * @param isAll
     * @return
     */
    public List<Map<String, Object>> getCbbFieldsByIsAllByIntfs(String orgId,String deptId,String sysId,String tableName,String isAll) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("tableName",tableName);
        resMaps.put("isAll",isAll);
        String url = BASE_PATH + "/getCbbFieldsByIsAllByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据列ID，获取列信息
     * @param colId
     * @return
     */
    public List<Map<String, Object>> getCbbColumnsByColIdByIntfs(String colId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("colId",colId);
        String url = BASE_PATH + "/getCbbColumnsByColIdByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据节点ID和表ID，删除表与节点关联关系
     * @param orgId
     * @param deptId
     * @param sysId
     * @param nodeId
     * @param tableId
     */
    public void deleteCbbTabNodeByNodeIdAndTabIdByIntfs(String orgId,String deptId,String sysId,String nodeId,String tableId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("nodeId",nodeId);
        resMaps.put("tableId",tableId);
        String url = BASE_PATH + "/deleteCbbTabNodeByNodeIdAndTabIdByIntfs/v1";
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg>() {
        });
        return;
    }


    /**
     *根据列ID，获取该列的组合项配置信息
     * @param colId
     * @return
     */
    public List<Map<String, Object>> getCbbColumnsConfigGropuAndSourceColNameByColIdByIntfs(String colId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("colId",colId);
        String url = BASE_PATH + "/getCbbColumnsConfigGropuAndSourceColNameByColIdByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }





//    public Map<String, Object> getColumnPageMap(Map<String, Object> parameter) {
//        Map<String,Object> resMaps = new HashMap<>();
//        resMaps.put("parameter",parameter);
//        String url = BASE_PATH + "/getColumnPageMap/v1";
//        ResponseMsg<Map<String, Object>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<Map<String, Object>>>() {
//        });
//        return RestClientUtils.getResponseBody(responseMsg);
//    }


    /**
     *获取公共字段表中的字段信息
     * @param param
     * @return
     */
    public List<Map<String, Object>> getPublicField(Map<String, Object> param) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("param",param);
        String url = BASE_PATH + "/getPublicField/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据表ID级列英文名，获取列信息
     * @param tableId
     * @param colName
     * @return
     */
    public List<Map<String, Object>> getCbbColumnsByTableIdAndColNameByIntfs(String tableId,String colName) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("tableId",tableId);
        resMaps.put("colName",colName);
        String url = BASE_PATH + "/getCbbColumnsByTableIdAndColNameByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据列id和语言code获取 列名
     * @param columnId
     * @param languageCode
     * @return
     */
    public String getColumnLabelByColumnIdAndLanguageCode(String columnId,String languageCode) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("columnId",columnId);
        resMaps.put("languageCode",languageCode);
        String url = BASE_PATH + "/getColumnLabelByColumnIdAndLanguageCode/v1";
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *我的订阅独有的查询公共字段方法
     * @param orgId
     * @param deptId
     * @param sysId
     * @param tableName
     * @return
     */
    public List<Map<String, Object>> getCbbTableAndColumnsByTabNameByIntfsItera(String orgId,String deptId,String sysId,String tableName) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("tableName",tableName);
        String url = BASE_PATH + "/getCbbTableAndColumnsByTabNameByIntfsItera/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据表ID，列英文名集合，获取列信息
     * @param tableId
     * @param colNameList
     * @return
     */
    public List<Map<String, Object>> getCbbColumnsByTableIdAndColNameListByIntfs(String tableId,List<String> colNameList) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("tableId",tableId);
        resMaps.put("colNameList",colNameList);
        String url = BASE_PATH + "/getCbbColumnsByTableIdAndColNameListByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *只根据根据表名，获取表信息以及列信息
     * @param tableName
     * @return
     */
    public List<Map<String, Object>> getCbbTableAndColumnsByOnlyTabNameByIntfs(String tableName) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("tableName",tableName);
        String url = BASE_PATH + "/getCbbTableAndColumnsByOnlyTabNameByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据表ID，获取表信息以及列信息
     * @param tableId
     * @return
     */
    public List<Map<String, Object>> getCbbTableAndColumnsByTabIdByIntfs(String tableId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("tableId",tableId);
        String url = BASE_PATH + "/getCbbTableAndColumnsByTabIdByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据列ID，获取该列的组合项配置信息
     * @param colId
     * @return
     */
    public List<Map<String, Object>> getCbbColumnsConfigGropuByColIdByIntfs(String colId) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("colId",colId);
        String url = BASE_PATH + "/getCbbColumnsConfigGropuByColIdByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *
     *根据字段类型，获取系统初始字段信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @param colType
     * @return
     */
    public List<Map<String, Object>> getCbbSysInitFieldsByColTypeByIntfs(String orgId,String deptId,String sysId,String colType) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("colType",colType);
        String url = BASE_PATH + "/getCbbSysInitFieldsByColTypeByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据字段类型，获取系统初始字段信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @param tableName
     * @return
     */
    public List<Map<String, Object>> getCbbTableAndColumnsByTabNameByIntfs(String orgId,String deptId,String sysId,String tableName) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("tableName",tableName);
        String url = BASE_PATH + "/getCbbTableAndColumnsByTabNameByIntfs/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }





//    public String getCbbMaxTableNameByNodeIdByIntfs(String orgId,String deptId,String sysId,String nodeId) {
//        Map<String,Object> resMaps = new HashMap<>();
//        resMaps.put("orgId",orgId);
//        resMaps.put("deptId",deptId);
//        resMaps.put("sysId",sysId);
//        resMaps.put("nodeId",nodeId);
//        String url = BASE_PATH + "/getCbbMaxTableNameByNodeIdByIntfs/v1";
//        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<String>>() {
//        });
//        return RestClientUtils.getResponseBody(responseMsg);
//    }


    /**
     *根据列id获取当前列的通用代码值
     * @param orgId
     * @param deptId
     * @param sysId
     * @param param
     * @return
     */
    public Map<String, Object> getColumnLookupByColumnId(String orgId,String deptId,String sysId,Map<String, Object> param) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("param",param);
        String url = BASE_PATH + "/getColumnLookupByColumnId/v1";
        ResponseMsg<Map<String, Object>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<Map<String, Object>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据表ID，获取列信息
     * @param orgId
     * @param deptId
     * @param sysId
     * @param tableId
     * @param map
     * @return
     */
    public List<Map<String, Object>> getCbbTabColumnsByMap(String orgId,String deptId,String sysId,String tableId,Map<String, Object> map) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("tableId",tableId);
        resMaps.put("map",map);
        String url = BASE_PATH + "/getCbbTabColumnsByMap/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据tableId 和 生成方式获取列信息
     * @param param
     * @return
     */
    public List<Map<String, Object>> getColumnsByParam(Map<String, Object> param) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("param",param);
        String url = BASE_PATH + "/getColumnsByParam/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }





//    public Map<String, Object> getColumnPageMapItera(Map<String, Object> paramMap,List<Map<String, Object>> columnInfoMap) {
//        Map<String,Object> resMaps = new HashMap<>();
//        resMaps.put("paramMap",paramMap);
//        resMaps.put("columnInfoMap",columnInfoMap);
//        String url = BASE_PATH + "/getColumnPageMapItera/v1";
//        ResponseMsg<Map<String, Object>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<Map<String, Object>>>() {
//        });
//        return RestClientUtils.getResponseBody(responseMsg);
//    }


    /**
     *根据tableId 和 生成方式获取列信息
     * @param param
     * @return
     */
    public List<Map<String, Object>> getColumnsByParameter(Map<String, Object> param) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("param",param);
        String url = BASE_PATH + "/getColumnsByParameter/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据表ID查询表下所有字段的通用代码值
     * @param orgId
     * @param deptId
     * @param sysId
     * @param tableId
     * @param param
     * @return
     */
    public Map<String, Map<String, String>> getColumnLookupByTableId(String orgId,String deptId,String sysId,String tableId,Map<String, Object> param) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("tableId",tableId);
        resMaps.put("param",param);
        String url = BASE_PATH + "/getColumnLookupByTableId/v1";
        ResponseMsg<Map<String, Map<String, String>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<Map<String, Map<String, String>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *查询当前组织下公共字段中所有字段的通用代码值
     * @param orgId
     * @param deptId
     * @param sysId
     * @param param
     * @return
     */
    public Map<String, Map<String, String>> getColumnLookupByPublicTable(String orgId,String deptId,String sysId,Map<String, Object> param) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("orgId",orgId);
        resMaps.put("deptId",deptId);
        resMaps.put("sysId",sysId);
        resMaps.put("param",param);
        String url = BASE_PATH + "/getColumnLookupByPublicTable/v1";
        ResponseMsg<Map<String, Map<String, String>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<Map<String, Map<String, String>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *通过参数获取表索引信息集合
     * @param param
     * @return
     */
    public List<Map<String, Object>> getTableIndexByParam(Map<String, Object> param) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("param",param);
        String url = BASE_PATH + "/getTableIndexByParam/v1";
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *检查对应模版类型是否存在相同字段
     * @param param
     * @return
     */
    public String checkTemplateFieldsRepeat(Map<String, Object> param) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("param",param);
        String url = BASE_PATH + "/checkTemplateFieldsRepeat/v1";
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *获取排序主表信息（分页）
     * @param pageNo
     * @param pageSize
     * @param parameter
     * @return
     */
    public Page<Map<String, Object>> getPageTabSortList(Integer pageNo, Integer pageSize, Map<String, Object> parameter) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("pageNo",pageNo);
        resMaps.put("pageSize",pageSize);
        resMaps.put("parameter",parameter);
        String url = BASE_PATH + "/getPageTabSortList/v1";
        ResponseMsg<Page<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<com.github.pagehelper.Page<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     *根据表名，获取表ID
     * @param tableName
     * @return
     */
    public String getCbbTableIdByTableNameIntfs(String tableName) {
        Map<String,Object> resMaps = new HashMap<>();
        resMaps.put("tableName",tableName);
        String url = BASE_PATH + "/getCbbTableIdByTableNameIntfs/v1";
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, resMaps, new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }





}
